/*
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

// 正例1：简单使用 indexOf 但不进行-1比较
function fOne(a: string): void {
    a.indexOf(b);
}

// 正例2：indexOf的结果用于其他运算
function fTwo(a: string): void {
    a.indexOf(b) + 0;
}


// 正例8：带i标志的正则表达式
function fEight(a: string): void {
    /bar/i.test(a);
}

// 正例9：复杂的正则表达式
function fNine(a: string): void {
    /ba[rz]/.test(a);
}

// 正例10：有选择的正则表达式
function fTen(a: string): void {
    /foo|bar/.test(a);
}

// 正例11：test方法没有参数
function fEleven(a: string): void {
    /bar/.test();
}

// 正例12：非正则表达式的test方法
function fTwelve(a: string): void {
    something.test(a);
}

// 正例13：RegExp实例
const patternOne = new RegExp('\\d');
function fThirteen(a) {
    return patternOne.test(a);
}
